<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <link href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/4.1.1/animate.min.css" rel="stylesheet">
  <style>
    .div1 {
      width: 300px;
      height: 300px;
      background-color: #56a5f1;
      border-radius: 5px;
    }
    .v-enter {
      opacity: 0;
    }
    .v-enter-active {
      transition: all 4s;
    }
    .v-enter-to {
      opacity: 1;
    }
    .v-leave{
      opacity: 1;
    }
    .v-leave-active {
      transition: all 4s;
    }
    .v-leave-to {
      opacity: 0;
    }
    /* =================== */
    .div2-enter {
      opacity: 0;
    }
    .div2-enter-active {
      transition: all 6s;
    }
    .div2-enter-to {
      opacity: 1;
    }
    .div2-leave{
      opacity: 1;
    }
    .div2-leave-active {
      transition: all 6s;
    }
    .div2-leave-to {
      opacity: 0;
    }
  </style>
</head>
<body>
  <div id="app">
    <p>过渡效果：使元素或页面切换得更加流畅、美观</p>
    <button @click="isShow = !isShow">toggle</button>
    <transition>
      <div v-if="isShow" class="div1">先</div>
    </transition>
    <transition name="div2">
      <div v-if="isShow" class="div1">后</div>
    </transition>
    <transition
        leave-active-class="animate__bounceIn"
        enter-active-class="animate__bounceOut">
      <div v-if="isShow" class="div1">后</div>
    </transition>
  </div>
  <script src="../vue.js"></script>
  <script>
    let vm = new Vue({
      el: '#app',
      data: {
        isShow: true
      }
    })
  </script>
</body>
</html>